<?php
include './config.php';
$mail_queue =& new Mail_Queue($db_options, $mail_options);

$link = mysql_connect('localhost', 'kunal17_dev', 'pt985fubrAPe');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('kunal17_dev', $link);
if (!$db_selected) {
    die ('Can\'t use mail_queue : ' . mysql_error());
}

$sql = "SELECT id FROM mail_queue WHERE 1 LIMIT 90";

$result = mysql_query($sql);

if (!$result) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();
    exit;
}

if (mysql_num_rows($result) == 0) {
    echo "No rows found, nothing to send";
    exit;
}

while ($row = mysql_fetch_assoc($result)) {
    $id = $row["id"];
    $mail_queue->sendMailById($id);
    $mail_queue->deleteMail($id);
}

mysql_free_result($result);
?> 